<?php include './application/views/common/zhs_header.php';?>
<?php include './application/views/common/zhs_usercenter_acnt.php';?>
<div class="inv_box w">
<?php include './application/views/common/zhs_usercenter_left.php';?>
  <div class="membd_right">
     <h3 class="membdrg_tit"><a class="zdbtn_1" href ="/account/zhs_bank.html">管理银行卡</a>  <a class="zdbtn_1" href ="/account/zhs_bank.html">添加银行卡</a>我的银行卡</h3>
     <div class="memtx_bd">
        <?php if($user['real_status']==1 && $user['paypassword'] && isset($bank0)) {?>
        <iframe name="iframe" style="display:none"></iframe>
        <form action="" method="post" target="iframe" id="cash_form">
        <input type="hidden" name="act" value="submit">
        <input type="hidden" name="smscode" value="<?php echo $smscode;?>" />
        <dl>
        <dt>选择提现银行卡：</dt>
        <dd><input class="lf" type="radio" <?php if($bank0['default_flag']=='1' || $bank1) echo "checked";?> name="bank_id" value="<?php echo $bank0['id'];?>" >
        <span class="ptt"><?php echo $bank_list[$bank0['bank']]; ?></span><span class="rg"> <?php echo strdisplay($bank0['account'],4); ?></span></dd>
        <?php if(isset($bank1)) {?>
        <dd style="margin-top:14px;"><input class="lf" type="radio"  name="bank_id"  value="<?php echo $bank1['id'];?>">
        <span class="ptt"><?php echo $bank_list[$bank1['bank']]; ?></span><span class="rg"> <?php echo strdisplay($bank1['account'],4); ?></span></dd>
        <?php }?>
         </dl>
       <ul class="txul">
         <li><p>真实姓名：</p><span><?php echo strdisplay($user['realname'], 1); ?></span></li>
         <li><p>账户总额：</p><span>￥<?php echo number_format($account['total'],2); ?>元</span></li>
         <li><p>可用余额：</p><span>￥<?php echo number_format($account['use_money'],2); ?>元</span></li>
         <li><p>提现金额：</p><span><input class="inpt_1" type="text" id="ckmoney" name="money"  value="" size="20" maxlength="6" onkeyup="shouxufei(this.value)"/><span style="float:left;margin-left:6px;">单笔提现金额50—500000元（实际到账金额：<em id="sxf" style="color:red ">0</em>元）</span></span></li>
         <li><p>预计到账日期：</p><span><?php echo date('Y-m-d',strtotime('2 days'));?>    1-2个工作日（双休日和法定节假日除外）之内到账</span></li>
         <li><p>*交易密码：</p> <span><input class="inpt_1"  type="password" name="paypwd"  value="" size="20" maxlength="20" /><span style="float:left"><a href="/user/zhs_find/index.html">*忘记密码</a></span></span></li>
         <!--<li><p>手机验证码：</p><span><input class="inpt_1" type="text" value="" name="verify" maxlength="8">
					<span style="float:left" id="phone_code">
						<input type="button" value="获取验证码" onclick="peSubmit()">
					</span></span>
		</li>-->
         <li><a class="membtn" style="margin-left:115px; width:110px;" href="javascript:document.getElementById('cash_form').submit(); ">确认提交</a></li>
       </ul>
       </form>
       <script type="text/javascript">
		var use_money =  <?php echo $account['use_money']; ?>;
		var invite_total = <?php echo $invite_total; ?>;
		var mf_money = <?php echo $cash_fee;?>;

		//手续费
		function shouxufei(money){
			if(money > use_money) {
				document.getElementById("ckmoney").value = use_money;
				money = use_money;
			}
			var sx_money = 0;
			var k0 = (use_money+invite_total) - money;
			if(k0 < mf_money){
				var k1 = mf_money-k0;
				if(k1 >= money) k1= money;
				sx_money = Math.round(k1*0.005*100)/100;
			}
			document.getElementById("sxf").innerHTML = money-sx_money;
			var len = money.length;
			if(money == ''){
				document.getElementById("ckmoney").value = '';
			}else if(money.substring(len-1,len)=='.'){
				document.getElementById("ckmoney").value= parseInt(money*100)/100 + '.';
			}else{
				var i = money.indexOf('.');
				if(i>0){
					document.getElementById("ckmoney").value=money.substring(0,i+3)
				}
			}
			
		}
		function peSubmit(){
			$.ajax({
				type: "post",
				url: "/reg/sendsms.html",
				success: function(ret){
					if(ret.info == 1){
						phone_countdown();
					}else{
						$("#phone_code").html(ret.msg);
						setTimeout(function(){
						$("#phone_code").html('<a href="javascript:;" onclick="peSubmit();" style="color:#a71e32; text-decoration:underline"> 重新获取手机验证码</a>');
							
						},3000);
					}
				},
				dataType: "json"
			});	
		}
		function phone_countdown(){
			var count = 180;
			var countdown = setInterval(CountDown, 1000); 
			function CountDown() {
				$("#phone_code").html('手机验证码已发送,请等待 <font style="color:#a71e32;">'+count+"</font>秒");
				if (count == 0) {
					$("#phone_code").html('<a href="javascript:;" onclick="peSubmit();" style="color:#a71e32; text-decoration:underline"> 重新获取手机验证码</a>');
					clearInterval(countdown);
				}
				count--;
			}
		}
		</script>
       <?php } else {?>
		<ul><li>
			<?php if($user['real_status']!=1) {?>
				<a href="/user/zhs_realname/index.html">请先完成实名认证!</a>
			<?php } elseif(!$user['paypassword']) {?>
				<a href="/user/zhs_paypwd/index.html">请先设置交易密码!</a>
			<?php } elseif(!isset($bank0)) {?>
				<a href="/account/zhs_bank/index.html">请先绑定银行账号!</a>
			<?php } ?>
		</li></ul>
		
		<?php } ?>
       <h3 class="txbd_ts"> 温馨提示:</h3>
       <h4 class="txbd_tsbd">
   		1、为了您的账户安全，请在充值前进行身份认证、手机及邮箱的绑定。<br>
   		2、请确保您输入的提现金额，以及银行帐号信息准确无误。<br>
   	
		3、提现信息不正确可能会导致提现失败，由此产生的提现费用将不予返还。<br>
		4、请注意您的银行卡充值和提现限制，以免造成不便。<br>
		5、禁止洗钱、信用卡套现、虚假交易等行为，一经发现并确认，将终止该账户的使用。<br>
		6、在双休日和法定节假日期间，用户可以申请提现，本平台会在下一个工作日进行处理。由此造成的不便，请见谅！<br>    
		</h4>
     </div>
     <h3 class="membdrg_tit mt">提现记录</h3>
 <div class="hk_body pt">
 <form id="tmpform"></form>
            <table class="membd_tab">
      <thead>
        <tr bgcolor="#F3F3F3" height="40px">
			<td align="center"><strong>提现银行</strong></td>
			<td align="center"><strong>提现账号</strong></td>
			<td align="center"><strong>提现总额</strong></td>
			<td align="center"><strong>到账金额</strong></td>
			<td align="center"><strong>手续费</strong></td>
			<td align="center"><strong>提现时间</strong></td>
			<td align="center"><strong>状态</strong></td>
			<td align="center"><strong>操作</strong></td>
		  </tr>
      </thead>
      <tbody>
        <?php foreach($list as $val){?>
		  <tr height="35px">
			<td align="center"><?php echo $bank_list[$val['bank']];?></td>
			<td align="center"><?php echo substr($val['account'],0,strlen($val['account'])-4).'****';//$val['account'];?></td>
			<td align="center">&yen;<?php echo number_format($val['total'],2);?></td>
			<td align="center">&yen;<?php if($val['fstatus'] == 4){?><?php echo number_format($val['credited'],2);?><?php }else{?>0.00<?php }?> </td>
			<td align="center">&yen;<?php echo number_format($val['fee'],2);?></td>
			<td align="center"><?php echo date('Y-m-d H:i',$val['add_time']);?></td>
			<td align="center"><?php echo $cash_status[$val['fstatus']];?></td>
			<td align="center"><?php if($val['fstatus'] == 0){?><a href="javascript:zhs_cancel('<?php echo $val['id']; ?>');">取消</a><?php }?> </td>
		  </tr>
		  <?php }?>
      </tbody>
    </table>
    <script type="text/javascript">
    function zhs_cancel(id){
    	var options = {
    			url : '/account/zhs_cash_cancel/'+id,
    			dataType: "json",
    			type:"get",
    			success : function(ret) {
    				$('#dialog').dialog({
    					modal:true,
    					title:'系统提示',
    					buttons:{"确定":function(){$(this).dialog("close");}},
    					close: function() {
    						if(ret.url==''){
    							window.location.reload();
    						}else{
    							location=ret.url;
    						}
    					}
    				}); 
    				$("#msg").html(ret.msg);
    			}
    		};
    		$('#tmpform').ajaxSubmit(options);
    		return false;
	}
    </script>
    	<div class="invbd_page"><?php echo $this->pagination->create_links();?></div>
    </div>
  </div>
</div> 

<?php include './application/views/common/zhs_footer.php';?>
<?php include './application/views/common/zhs_right.php';?>

